import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

public class CourseDao {
public static ArrayList<Course> queryCourseList(){
	ArrayList<Course> courseList=new ArrayList<>();
	Connection conn=ConnectionUtil.getConnection();
	String sql="select * from course";
	try {
		Statement stat=conn.createStatement();
	
		
		ResultSet rs=stat.executeQuery(sql );
		while(rs.next()) {
			int course_id=rs.getInt(1);
			String course_name=rs.getString(2);
			String course_teacher=rs.getString(3);
			Course course=new Course(course_name,course_teacher,course_id);
			courseList.add(course);
		}
	}catch(SQLException e) {
		e.printStackTrace();
	}
	return courseList;
}
	

}
